Now let's get our animation editor going so we could put a kickback animation on our pistol.
So when we fire it, bam, it pops up.
That makes it look a little more realistic.
And it's a good introduction to the animation editor, a nice, simple one.
Click on the Avatar tab and we're going to create animations that are going to go on our players.
We need a rig to do this, and a rig is a character.
It's a dummy character.
So we're going to click on Rig Builder.
We have two choices are 15 are six.
Let's say a quick look at each of them.
Here's an AR 15.
I'll pick man rig.
You can play around with them, but that's most like my player, right?
So there's 15 body parts.
That's why it's called an AR 15, 15 movable body parts.
So from your left foot down to your head, there's 15 of those 15 items, but not including the humanoid
root part, because we're not going to animate that.
And let's take a look at the R six.
So if we look at our six man rig, there are six body parts that can do animation stuff, right?
That you can move around head, not humanoid part.
And then these five down here so.
If you're confused on what you should use, use AR 15, because we've only been doing AR 15 up to this
point.
If you know our six stuff and you want to try our six, go ahead.
If this is all new though, I recommend just following along directly.
If we go to home.
Right, and take a look at our game settings.
Go to Avatar and this is how you can change what your players are going to use for their character,
our six or our 15.
It defaults to our 15.
If we use player choice, we're going to have to do an animation for both of these, decide what the
player is using and then use that animation.
That's a little tricky.
Let's stick with our 15.
Go ahead and close this window.
We're not going to change it.
Keep it AR 15.
And then let's go back to our Avatar tab.
We're going to hit animation editor and we're going to get a new window if it's floating around somewhere
weird, like like here.
Just go ahead and move it.
And what you want to do is move it over the section that you want.
See, I'm on that with my mouse.
Boom.
It goes right there.
Cool.
I like to have my little guy facing to the right.
Right.
That's just a preference.
It says select the rig so that you can start creating.
We're going to click on it, and then we are going to call this animation kickback.
Right?
It's kickback for our pistol.
Hit create.
And now let's take a look at some of these options down here in the lower left corner.
I got these three dots.
Open this up and I'm going to show you the thing that messes most people up.
It's animation priority.
All right.
And I know you can't see these bottom ones down here below Action two, but the animation priority determines
what animations are going to play if there's a conflict.
So Idol is like if you're standing around doing nothing that will be overtaken by movement.
If you hit your W key and you start running right, action is going to overtake movement if there's
a conflict.
So if you go ahead and pick up a gun and you want to shoot, you want the action to overtake what's
happening for the movement if there is a conflict.
So I'm going to go action because we're going to be shooting a pistol.
That's an action movement.
Same with like swing and a sword, stuff like that.
Now what I'm going to do, I'm going to hit these three dots.
I'm going to hit save.
And let's take a look at our dummy.
Right.
There's our dummy.
If we take a look at down in here, we have a model, right?
And inside the model we have our kickback.
So the animation keyframes of the animation you're creating is saved here.
If you delete your dummy, you're going to lose your animation, right?
So don't delete your dummy until you're done.
You polished it or you save this off someplace.
All right.
Now we kind of lost this.
That's all right.
We'll just click here to continue.
Let's take a look at this thing right here.
This is our timeline.
It is in seconds frames.
That's the units.
So this is a full second.
See how it's 100.
So it's the next second.
The zero frame right here.
This is the zero frame.
Zero second, if you want to change your timeline, maybe you're used to another type of animation editor.
You could do that with frames or second frames.
You only have two choices, right?
Frame rate, 30 frames per second.
So we're going to have a we're going to be able to animate on 30 different frames over a one second
period.
That should be sufficient, especially for what we're doing.
And then we have playback speed that's relatively new.
I was just keeping up one and I keep this at 30.
All right.
So now let's go ahead and do some animating.
This is our scrubber bar.
So wherever this is, the keyframes are going to be created.
When we move this dummy, I'm going to click on them.
And I got this little rotate thing here.
If you don't have it, go ahead and click on Rotate and then you'll have it.
I like to keep my snap grid for rotate checked and at 15 degrees if I can, sometimes I need more precise
movement, so I'll decrease this number.
All right.
So I clicked this upper arm.
I don't know if you see that.
And this little L here means the rotate is going to be relative to the part that I'm moving.
If I do a control L, that's relative to the global coordinate system.
Right.
And then you'll get better at that as we I'll explain it as I go along.
That's a little bit hard to follow.
So I clicked.
I clicked that arm.
And when we're holding a tool, the arm is up like that.
If you've noticed that when you had your pistol, the arm went up.
If it's a hammer or a flashlight, it's going to be the same thing.
All right.
When we fire, it's going to pop up.
So I'm going to click maybe on the third frame.
Notice how my scrubber bar moved out here.
Now, when I move the hand up on to three, move it up 45 degrees.
We got keyframes, right?
These are key frames.
If we want to see what happened at zero, make sure you don't go too far or you're going to get this
weird thing comes up.
Hit, cancel, go to zero.
That's what it's at.
Zero.
That's what it's at.
Three, three frames.
Let's go to zero.
Right click.
Copy.
Go out to the 15th frame, which is 0.5 seconds.
Right.
30 frames per second.
I'm going to.
Copy selected.
Whoops, I lost it.
Oh, that was the copy selector.
I'm going to pay selected and paste keyframes.
There we go.
That's a little rough.
I'm sorry about that.
And now we're going to try this out.
Boom, boom.
That looks like it's going to work.
All right, I'm going to hit my three dots.
I'm going to save it again.
And that's going to save it to the dummy.
We're not going to use that.
What we're going to do, hit these three dots, publish two roadblocks.
Now you have to publish the roadblocks under your account, right?
Or it's not going to work.
Hit the submit button.
And you're going to get an ID.
Your ID is not going to match my ID if you use my ID.
It's not going to work in your game.
Your games need to have IDs created under your Creator ID or your game making ID, so I just copied
that by clicking these two boxes.
Hit close.
If you lose it, you can go to the website and look under creations for animations.
Then you could find the ID again.
That's a pain, but we're not going to lose it.
We're going to go down to our gun in our starter pack, open up the pistol, we're going to hit that
plus sign, hit an A for animation.
Right.
And there's a lot of things that look like animation.
Make sure it says animation.
Click on animation.
See that ID?
Right or left?
Yeah, right Click paste.
Your ID just went there.
Hit enter boom.
And then you got this RB asset ID pre pended.
So there you go.
Now, we saved it off.
So this just says animation.
We need to make it a little more descriptive because we're going to also have a reload animation under
and make sure you're under simple pistol just in case you don't want to lose it.
I'm going to call this kick back and.
All right.
So we got our kick back in him.
We got our ID, It's under the simple pistol.
Let's go to the shoot script.
Under the simple pistol.
That's the local script.
Get rid of that window there.
So we have more space.
And up in the top where we have our variable section.
Let's go below canned shoot.
We're going to define two variables.
We're going to define one.
Define one called kickback.
And M I'll do a script dot parent colon, wait for child.
There it is.
Kick back in him inside speech quotes.
I'm going to do another variable for the kick back track.
So kick back track, this is going to be the playable track.
So this is the animation.
We're going to load it inside of our character and this is going to be the track variable that we're
going to get back so we can play it, we can hit, play and stop and stuff like that.
It's nil right now because we can't get that track yet.
Let's go down to our on equipped.
When we pick up the weapon, then we have a player.
We can get the character.
We need the character two different ways we can get it from the tool.
Once you equip it, the parent of the tool is the character, or we can get it from the player.
I'm going to get it from the player.
It's just preference I'll do now.
Player Let's think in player, right.
I want to get the char, the character from the player.
So I'm going to do player dot character.
That will give me the character if it's there.
But it could take up to 2 seconds for a character to load.
This is a shooting game.
We may be responding, we pick up our weapon, character's not fully complete.
Let's do an or player dot character added.
Wait.
And this is going to pause the script right here until the character is added.
We're going to wait there, then we'll have the character here.
So once we get the character, we're going to need the humanoid local.
We're going to get the humanoid char wait for child humanoid.
Now, it used to be able to you can still do this, actually, you can load the animation right into
the humanoid.
They don't recommend it.
They recommend using an animator or animator.
Right.
And that is in the humanoid.
So humanoid wait for child animator.
Cool.
So if we look at our dummy real quick.
Dummy humanoid animator.
Now your character has an animator to some r sixes.
Some of the R six regs maybe have the animator now, but even like within the last six months, some
of them didn't.
So if you're going to we're not doing anything with that now, but just be forewarned.
But your character will definitely have an animator.
All right.
So then we're going to do know.
What we're going to do is we're going to get our track, we're going to get our kickback track.
We're going to get that when we get our animator and load the animation and we'll just go ahead and
do our kickback animation.
So we're going to get the animation.
Load animation inside the animator.
Get the track.
We can play the track.
We're good to go.
So when we shoot, let's go right before we fire our motive into the server to do damage.
Kick back track Colon play.
Let's check.
Let's check it out.
Hit the play.
And we're going to pick up our pistol.
I want to check at the front to see if it goes straight up.
Yep.
Yeah.
This is looking good.